<?php

  $root = dirname(dirname(__FILE__));
  $trunk = $root . DIRECTORY_SEPARATOR . "__phpackager__";
  $tests = $root . DIRECTORY_SEPARATOR . "tests" . DIRECTORY_SEPARATOR . "__phpackager__";

  $packages = array_merge(
    glob("$trunk\\*", GLOB_ONLYDIR),
    glob("$tests\\*", GLOB_ONLYDIR)
  );

  $paths = array( get_include_path() );
  foreach ($packages as $path) {
    $path = realpath($path . "/library");
    if ($path)
      array_push($paths, $path);
  }

  set_include_path(implode(PATH_SEPARATOR, $paths));
